<!--{block return}-->
<script type="text/javascript" src="./source/plugin/iweitao_paipai/js/jquery.js"></script>
<script type="text/javascript">
jQuery = jQuery.noConflict();

jQuery(document).ready(function (){
	
	//点击小图切换大图
	jQuery("#thumbnail li a").click(function(){
		jQuery(".zoompic img").hide().attr({ "src": jQuery(this).attr("href"), "title": jQuery("> img", this).attr("title") });
		jQuery("#thumbnail li.current").removeClass("current");
		jQuery(this).parents("li").addClass("current");
		return false;
	});
	jQuery(".zoompic>img").load(function(){
		jQuery(".zoompic>img:hidden").show();
	});
	
	//小图片左右滚动
	var slider = jQuery('.slider ul');
	var slider_child_l = jQuery('.slider ul li').length;
	var slider_width = jQuery('.slider ul li').width();
	slider.width(slider_child_l * slider_width);
	
	var slider_count = 0;
	
	if (slider_child_l < 5) {
		jQuery('#btn-right').css({cursor: 'auto'});
		jQuery('#btn-right').removeClass("dasabled");
	}
	
	jQuery('#btn-right').click(function() {
		if (slider_child_l < 5 || slider_count >= slider_child_l - 5) {
			return false;
		}
		
		slider_count++;
		slider.animate({left: '-=' + slider_width + 'px'}, 'fast');
		slider_pic();
	});
	
	jQuery('#btn-left').click(function() {
		if (slider_count <= 0) {
			return false;
		}
		slider_count--;
		slider.animate({left: '+=' + slider_width + 'px'}, 'fast');
		slider_pic();
	});
	
	function slider_pic() {
		if (slider_count >= slider_child_l - 5) {
			jQuery('#btn-right').css({cursor: 'auto'});
			jQuery('#btn-right').addClass("dasabled");
		}
		else if (slider_count > 0 && slider_count <= slider_child_l - 5) {
			jQuery('#btn-left').css({cursor: 'pointer'});
			jQuery('#btn-left').removeClass("dasabled");
			jQuery('#btn-right').css({cursor: 'pointer'});
			jQuery('#btn-right').removeClass("dasabled");
		}
		else if (slider_count <= 0) {
			jQuery('#btn-left').css({cursor: 'auto'});
			jQuery('#btn-left').addClass("dasabled");
		}
	}
	jQuery("#checkout").click(function() {
		jQuery.ajax({
			url : "plugin.php",
			type : "GET",
			dataType: "html",
			data : {
				id : 'iweitao_paipai:ajax',
				act : 'checkout',
				tid : '{$array["tid"]}',
				gid : '{$array["gid"]}'
			},
			success : function (data) {
				showDialog(data,'alert');
			}
		})
	});
});
</script>

<style type="text/css">
.order_detail table{width:100%; border:1px solid #CCC; margin-bottom:20px;}
.order_detail table tr{height:35px;background-color:#F2F7FF;}
.order_detail table tr td{padding:8px; border-bottom:1px solid #CCC;}
#tbw{background:#FFFFFF;}
#main_div{height:450px; width:100%;float:left;}
.zoombox{width:45%;float:left;}
.zoompic{border:solid 1px #dfdfdf; background:url(./source/plugin/iweitao_paipai/image/loading2.gif) no-repeat 50% 50%; height: 300px;
    width: 300px; margin-top:5px;}
.zoompic img{border:1px solid #CCC;padding:2px;}
.sliderbox{height:76px;overflow:hidden;margin:6px 0 0 0; width:520px; margin-bottom:10px; margin-top:10px;}
.sliderbox .arrow-btn{width:38px;height:76px;background:url(./source/plugin/iweitao_paipai/image/arrow-btn.png) no-repeat;cursor:pointer;}
.sliderbox #btn-left{float:left;background-position:0 0;}
.sliderbox #btn-left.dasabled{background-position:0 -76px;}
.sliderbox #btn-right{float:right;background-position:-38px 0;}
.sliderbox #btn-right.dasabled{background-position:-38px -76px;}
.sliderbox .slider{float:left;height:76px;width:60%;position:relative;overflow:hidden;margin:0 0 0 3px;display:inline;}
.sliderbox .slider ul{position:absolute;left:0;width:999em;}
.sliderbox .slider li{float:left;width:63px; height:74px;text-align:center;}
.sliderbox .slider li img{border:solid 1px #dfdfdf; margin-right:10px; float:left;}
.sliderbox .slider li.current img{border:solid 2px #FF6699; border-radius:3px;}
.buy_detail{height:485px; width:400px; float:left;margin-top:5px; margin-left:10px;}
.buy_detail h1{font-size:25px;line-height:30px;}
.buy_detail h1:hover{color:#FF7300;text-shadow:3px;}
.buy_detail ul {padding-top:20px;}
.buy_detail ul li{padding-bottom:20px; font-weight:bold;}
.buy_right_now{border:none;background-image: url("./source/plugin/iweitao_paipai/image/buy_button.png"); background-repeat: no-repeat; height:38px; width:130px;float:left; margin-right:20px; margin-left:10px;}
.plus_shopping_car{border:none;background-image: url("./source/plugin/iweitao_paipai/image/buy_button.png"); background-repeat: no-repeat; background-position: -132px 0; height:38px; width:155px;float:left;}
#main_button{height:50px; width:100%; margin-top:30px;float:left;}
.main_input{float:left; border:1px solid #CCC;border: 1px solid #A7A6AC;color: #666666;font-size: 12px;height: 15px; margin-right:10px; width: 102px;background:url(./source/plugin/weitao_paipai/image/input.png);background-position: -406px -41px;height:20px;}
.increase{ margin-top: 3px;float:left; background-image: url("./source/plugin/iweitao_paipai/image/act.png"); background-position: 0 -32px; height:15px; width:15px; padding-left:10px;}
.decrease{ margin-top: 3px;float:left; background-image: url("./source/plugin/iweitao_paipai/image/act.png"); height:15px; width:15px;background-position: 0 -46px; padding-right:10px;}
#plus_but{float:left;}
.paimaibutton{margin-top:-5px; border:none; height:40px; width:127px; background: url("./source/plugin/iweitao_paipai/image/act2.png") no-repeat -127px -108px;}
.pai:hover{background:none repeat scroll 0 0 #FFF3D9}
.pai{margin-top:10px;padding-top:10px;padding:15px;height:40px;width:90%;background: none repeat scroll 0 0 #F9F9F9; border: 1px solid #EDEDED;}
</style>
<div id='main_div'>
	<div class="zoombox">

		<div class="zoompic"><img src="./data/attachment/forum/$array['focus']" width="300" height="300" onerror='javascript:this.src="./source/plugin/iweitao_paipai/image/pg_bg1.png"'/></div>
		
		<div class="sliderbox">
			<!--<div id="btn-left" class="arrow-btn dasabled"></div>-->
			<div class="slider" id="thumbnail">
				<ul>
					<li>
						<a href="./data/attachment/forum/$array['focus']" target="_blank">
							<img src="./data/attachment/forum/$array['focus']" width="50" height="52" onerror='javascript:this.src="./source/plugin/iweitao_paipai/image/pg_bg1.png"'/>
						</a>
					</li>
					<li>
						<a href="./data/attachment/forum/$array['focus2']" target="_blank">
							<img src="./data/attachment/forum/$array['focus2']" width="50" height="52" onerror='javascript:this.src="./source/plugin/iweitao_paipai/image/pg_bg1.png"'/>
						</a>
					</li>
					<li>
						<a href="./data/attachment/forum/$array['focus3']" target="_blank">
							<img src="./data/attachment/forum/$array['focus3']" width="50" height="52" onerror='javascript:this.src="./source/plugin/iweitao_paipai/image/pg_bg1.png"'/>
						</a>
					</li>
					<li>
						<a href="./data/attachment/forum/$array['focus4']" target="_blank">
							<img src="./data/attachment/forum/$array['focus4']" width="50" height="52" onerror='javascript:this.src="./source/plugin/iweitao_paipai/image/pg_bg1.png"'/>
						</a>
					</li>
					<li>
						<a href="./data/attachment/forum/$array['focus5']" target="_blank">
							<img src="./data/attachment/forum/$array['focus5']" width="50" height="52" onerror='javascript:this.src="./source/plugin/iweitao_paipai/image/pg_bg1.png"'/>
						</a>
					</li>
				</ul>
			</div>
			<!--<div id="btn-right" class="arrow-btn" style='float:left'></div>-->
		</div>
		
	</div>
	<div class='buy_detail'>
		<h1>{$array["title"]}<span style='font-size:12px;padding-left:20px;'>竞拍模式:{$thread_type}</span></h1>
		<ul>
			<!--{if $admingroup == $_G['groupid']}-->
				<li>管理工具 : 
					<A href='plugin.php?id=iweitao_paipai:act&act=freeze&tid={$tid}'>冻结交易</a> | 
					<A href='plugin.php?id=iweitao_paipai:act&act=unfreeze&tid={$tid}'>解冻交易</a>
				</li>
			<!--{/if}-->
			<li>商品类型:&nbsp;&nbsp;{$array['type']} &nbsp;&nbsp;&nbsp;&nbsp;制作材料:&nbsp;&nbsp; {$array['made']}</li>
			<li>起拍价格:&nbsp;&nbsp;{$array['price']} &nbsp;&nbsp;&nbsp;&nbsp;加价价格:&nbsp;&nbsp;{$array['add_price']}</li>
			<li>拍卖时间:{$array['data_start']}&nbsp;至&nbsp;{$array['data_end']}</li>
			<li>{$array['str']}</li>
			<!--{if $array['uid'] == $_G['uid']}--><li>{$end}</li><!--{/if}-->
			
		</ul>
		<div class='pai'>
			<span style='float:left;margin-right:10px;padding-top:4px;'>竞拍价格:</span>
			<div class="decrease"></div><!--{eval $present = $array["price"]+$array["add_price"];}-->
			<input type='text' name='price' id='getprice' class='main_input' maxlength='8' value='{$present}'>
			<div class="increase"></div>
			<input class="paimaibutton"  id="paimaibutton" type="button" value="" name="price">
		</div>
	</div>
</div>
<div class='order_detail'>
	<table>
		<Tr><td>用户名</td><td>出价时间</td><Td>价格</td><td>状态</td></tr>
		<!--{loop $detail $k $v}-->
			<!--{if $v['status'] == 2}--><tr><!--{else}--><tr id='tbw'><!--{/if}-->
				<Td>{$v['username']}</td>
				<Td>{$v['time']}</td>
				<Td>{$v['price']}</td>
				<Td>
				<!--{if $v['status'] == 1}-->领先<!--{elseif $v['status'] == 2}-->出局<!--{else}-->
					<!--{if $v['idenfity'] == 'default' && $v['status'] == 4}-->
						交易成功
					<!--{elseif $v['status'] == 3 && $array['idenfity'] == 'tenpay'}-->
						等待支付全款
					<!--{elseif $v['status'] == 4 && $array['idenfity'] == 'tenpay'}-->
						等待确认收货
					<!--{/if}-->
					<!--{if $_G['uid'] == $v['uid'] && $v['status'] != 4}-->
						<!--{if $v['status'] == 3 && $array['idenfity'] == 'tenpay'}-->
							（<a href='plugin.php?id=iweitao_paipai:ajax&orderid={$v["orderid"]}&act=pay'>支付全款</a> | <a href='plugin.php?id=iweitao_paipai:ajax&orderid={$v["orderid"]}&act=return'>退款</a>）
						<!--{elseif $v['status'] == 3 && $array['idenfity'] == 'default'}-->
							（<a href='plugin.php?id=iweitao_paipai:ajax&orderid={$v["orderid"]}&act=pay'>确认收货</a> | <a href='plugin.php?id=iweitao_paipai:ajax&orderid={$v["orderid"]}&act=return'>退款</a>）
						<!--{/if}-->
					<!--{elseif $_G['uid'] == $v['uid'] && $v['status'] == 4}-->
						<!--{if $v['status'] == 4 && $array['idenfity'] == 'tenpay'}-->
							（<a href='plugin.php?id=iweitao_paipai:ajax&orderid={$v["orderid"]}&act=tenpay'>确认收货</a> | <a href='plugin.php?id=iweitao_paipai:ajax&orderid={$v["orderid"]}&act=return'>退款</a>）
						<!--{else}-->
							（交易结束）
						<!--{/if}-->
					<!--{else}-->
						交易结束
					<!--{/if}-->
				<!--{/if}--></td>
		</tr>
		<!--{/loop}-->
	</table>
</div>
<script>
jQuery = jQuery.noConflict();
jQuery(document).ready(function() {
	jQuery(".increase").click(function() {
		default_value= jQuery(".main_input").val();
		v = parseInt({$array['add_price']});
		a = parseInt(default_value);
		default_value = a+v;
		jQuery(".main_input").val(default_value);
	});
	jQuery(".decrease").click(function() {
		default_value= jQuery(".main_input").val();
		v = parseInt({$array['add_price']});
		default_value = default_value-v;
		if(default_value == 0) {
			return false;
		}
		jQuery(".main_input").val(default_value);
	});
	function getid_auc(id) {
		return document.getElementById(id);
	}
	jQuery("#paimaibutton").click(function() {
		jQuery.ajax({
			url : "plugin.php",
			type : "GET",
			dataType: "html",
			data : {
				id : 'iweitao_paipai:ajax',
				act : 'buy',
				tid : '{$array["tid"]}',
				gid : '{$array["gid"]}',
				price : getid_auc('getprice').value
			},
			success : function (data) {
				if(data == 1) {
					showDialog("交易参与成功",'right');location.reload();
				} else if(data == -2) {
					showDialog("对不起，该交易暂未开始或已结束",'alert');
				} else if(data == -3) {
					showDialog("对不起，交易价格不合法",'error');
				} else if(data == -4) {
					showDialog("对不起，请加价后操作",'error');
				} else if(data == -5) {
					showDialog("对不起，您的积分不足",'error');
				} else if(data == -6) {
					showDialog("对不起，商品发布人不可以参与拍卖",'error');
				} else if(data == -7) {
					showDialog("对不起，当前交易冻结中",'error');
				} else {
					showDialog("交易参与失败",'error');
				}
				
			}
		})
	});
});
</script>

<!--{/block}-->